/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package daa.levelup.stopper;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

/**
 *
 * @author user
 */
public class Stopper
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        String num;
        System.out.println("enter elements ");
        Scanner sc = new Scanner(System.in);//get data
        LinkedList<String> strList = new LinkedList<String>();

        do
        {
            num = sc.nextLine();
            if (num.equals("stop"))
            {
                break;
            }
            strList.add(num);
        }
        while (!num.equals("stop"));
        Iterator<String> iter = strList.iterator();
        while (iter.hasNext())
        {
            for (int i = 0; i < strList.size(); i++)
            {
                System.out.print( iter.next());

                if (i != strList.size() - 1)
                {

                    System.out.print(",");
                }
            }
        }
    }
}
